﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;

using agree.schema;

using alib.Collections.ReadOnly;
using alib.Concurrency;
using alib.Debugging;

namespace agree
{
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>
	/// management of the statistics for some type of operation
	/// </summary>
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	public unsafe class TfsUnifier : has_grammar_base, ρρRestrictors
	{
		public TfsUnifier(IRtParent parent)
			: base(parent)
		{
		}

		public new Isometrics Isometrics
		{
			get { return base.im; }
			set
			{
				base.Grammar = value.Grammar;
				this.Restrictors = ftm.ParseRestrictors;
			}
		}

		public Restrictors Restrictors { get; set; }

		//[MethodImpl(MethodImplOptions.AggressiveInlining), DebuggerStepThrough]
		public bool UnifyCheck(ITfsSlot ts0, ITfsSlot ts1)
		{
			return Unification.Check(Restrictors.r_none, ts0, ts1);
		}
		//[MethodImpl(MethodImplOptions.AggressiveInlining), DebuggerStepThrough]
		public ArrayTfs UnifySection(TfsSlot ts_outer, ITfsSlot ts_inner, Tfs.Flags opts)
		{
			return Unification.UnifySection(Restrictors.FromTfsFlags(opts), opts, ts_outer, ts_inner);
		}
		//[MethodImpl(MethodImplOptions.AggressiveInlining), DebuggerStepThrough]
		public Tfs UnifyAllDaughters(Tfs mother, Tfs[] dtrs)
		{
			return Unification.UnifyAllDaughters(mother, dtrs);
		}
	};
}
